package io.github.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义业务异常
 *
 * @author haijun
 * @version 1.0.0
 * @email "1424132610@qq.com"
 * @date 2024.10.19 11:23
 * @since 1.0.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BusinessException extends RuntimeException{

    /**
     * 异常码默认 40000业务异常
     */
    private int code = 40000;

    /**
     * Business exception
     *
     * @param message message
     * @param code    code
     * @since 1.0.0
     */
    public BusinessException(String message, int code) {
        super(message);
        this.code = code;
    }

    /**
     * Business exception
     *
     * @param message message
     * @since 1.0.0
     */
    public BusinessException(String message) {
        super(message);
    }
}
